package dev.ece.suit.loader.models.fbx;

import java.util.List;

public class FBXAnimationStack {

	public final static String ANIMATION_STACK = "AnimationStack";
	
	private long id;
	
	private String name;
	
	private FBXAnimationStack() {}
	
	public static FBXAnimationStack[] parseFBXAnimationStack(List<FBXElement> elements) {
		if(elements != null && !elements.isEmpty()) {
			FBXAnimationStack[] stacks = new FBXAnimationStack[elements.size()];
			FBXElement element = null;
			for(int i=0; i<stacks.length; i++) {
				element = elements.get(i);
				stacks[i] = new FBXAnimationStack();
				stacks[i].id = (Long) element.getProperties()[0].getValue();
				stacks[i].name = (String) element.getProperties()[1].getValue();
			}
			return stacks;
		}
		return null;
	}
	
	public static float fixLongTimeToFloat(long time) {
		double dtime = (double) time / 46186158000L;
		return (float) dtime;
	}

	public static long fixFloatTimeToLong(float time) {
		return (long) (46186158000L * time);
	}
	
	public long getId() {
		return id;
	}

	public String getName() {
		return name;
	}
	
}
